package com.excellent.mvvm.bean

import android.text.TextUtils

/**
 * @author: lw
 * @date: 2021/11/26 10:24
 * @description：
 */
data class ServerUrlBean(
    var apiDomain: String?,     //api域名,例如api.baidu.com
    var h5Domain: String?,      //h5域名,例如m.baidu.com
    var priority: Int = 1,      //优先级,值越大优先级越高
    var protocol: String?,       //协议类型,例如http,https
    var shareDomain:String?,     //分享域名
    var name: String?,
    var environmentType:Int?,     //服务器环境类型（1：生产 2：预生产 3:审核 4:开发)
    var inviteDomain:String?
) {
    override fun equals(other: Any?): Boolean {
        if (other != null && other is ServerUrlBean) {
            return TextUtils.equals(apiDomain, other.apiDomain) && TextUtils.equals(protocol, other.protocol)
        }
        return false
    }

    fun createApiUrl(): String {
        return "$protocol://$apiDomain/"
    }

    fun createH5Url(): String {
        return "$protocol://$h5Domain/"
    }

    fun createShareUrl():String{
        return "$protocol://$shareDomain/"
    }

    fun createInviteDomain():String{
//        LogUtil.d2LocalLog("createInviteDomain= ${protocol}://${inviteDomain}")
        return "$protocol://$inviteDomain"
    }

}